<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="/WEB-INF/html.tld" prefix="html" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
 
<html:table attributes="class='inputTable' border='0' width='100%'">
 			<tr>
				<td colspan="5" class="subSectionBottomBorder">										
					<h4><spring:message text="label.add.assets">Assets for Finance</spring:message>&nbsp;</h4>
				</td>
			</tr>
			<tr>
				<html:td><label class="alpha-numeric required"><spring:message code='label.asset.code'/></label></html:td>
				<html:td><label class="alpha-numeric required"><spring:message code='label.model'/></label></html:td>
				<html:td><label class="alpha-numeric required"><spring:message code='label.manufacturer'/></label></html:td>
				<html:td><label class="alpha-numeric required"><spring:message code='label.name'/></label></html:td>

				
			</tr>
			<tr>
				<html:td><form:input path="asset.assetCode" name="asset.assetCode" css="alpha-numeric required"></form:input></html:td>
				<html:td><form:input path="asset.assetModel" name="asset.assetModel" css="alpha-numeric required"></form:input></html:td>
				<html:td><form:input path="asset.manufacturer" name="asset.manufacturer" css="alpha-numeric required"></form:input></html:td>
				<html:td><form:input path="asset.name" name="asset.name" css="alpha-numeric required"></form:input></html:td>

			</tr>
			
			<tr>
				<html:td><label class="numeric required"><spring:message code='label.year'/></label></html:td>
				<html:td><label class="numeric required"><spring:message code='label.price'/></label></html:td>
				<html:td><label class="numeric optional"><spring:message code='label.tax'/></label></html:td>
				<html:td><label class="alpha-numeric optional"><spring:message code='label.promotion.code'/></label></html:td>

				
			</tr>
			<tr>
				<html:td><form:input path="asset.assetYear" name="asset.assetYear" css="numeric required"></form:input></html:td>
				<html:td><form:input path="asset.assetPrice" name="asset.assetPrice" css="numeric required"></form:input></html:td>
				<html:td><form:input path="asset.tax" name="asset.tax" css="numeric optional"></form:input></html:td>
				<html:td><form:input path="asset.promotionCode" name="asset.promotionCode" css="alpha-numeric optional"></form:input></html:td>

				
			</tr>
			<tr>
				<html:td><label class="boolean optional"><spring:message code='label.onsale'/></label></html:td>
				<html:td><label class="alpha-numeric optional"><spring:message code='label.batch.no'/></label></html:td>
				<html:td><label class="alpha-numeric optional"><spring:message code='label.serial.no'/></label></html:td>
				<html:td><label class="numeric optional"><spring:message code='label.group.id'/></label></html:td>
			
			</tr>
			<tr>
				<html:td><form:input path="asset.onSale" name="asset.onSale" css="boolean optional"></form:input></html:td>
				<html:td><form:input path="asset.batchNo" name="asset.batchNo" css="alpha-numeric optional"></form:input></html:td>
				<html:td><form:input path="asset.SerialNo" name="asset.SerialNo" css="alpha-numeric optional"></form:input></html:td>
				<html:td><form:input path="asset.groupId" name="asset.groupId" css="numeric optional"></form:input></html:td>

			</tr>
			<tr>
				<html:td>&nbsp;</html:td>
				<html:td>&nbsp;</html:td>
				<html:td>&nbsp;</html:td>
				<html:td><a href="javascript:saveApplicationAsset();">Save</a></html:td>

			</tr>
	</html:table>
	
	<script>
	
	function saveApplicationAsset()
	{
		
		<c:url var="url" value="asset_add" />
		jQuery.ajaxSettings.traditional = true;

		var formData = $("#applicationForm").serializeObject();
		
		alert("${url}");
		alert(JSON.stringify(formData));
		var params={url:"${url}",complete:onComplete,error:onError,success:onSuccess,data:formData,type:"POST",dataType:"text"};
		doAjax(params);
	}
	
	function onComplete()
	{}
	function onSuccess(result)
	{
		
		var formData = $("#applicationForm").serializeObject();
		updateGrid(formData);
		 $("#applicationForm").clear();
	
	}
	function onError()
	{}
	
	
	</script>
 